using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Data.Models.Mapping
{
    public class BOMMap : EntityTypeConfiguration<BOM>
    {
        public BOMMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.Name)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.Description)
                .HasMaxLength(1000);

            this.Property(t => t.Code)
                .HasMaxLength(50);

            this.Property(t => t.Color)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("BOMS");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.Active).HasColumnName("Active");
            this.Property(t => t.EffectiveDate).HasColumnName("EffectiveDate");
            this.Property(t => t.ProductID).HasColumnName("ProductID");
            this.Property(t => t.Code).HasColumnName("Code");
            this.Property(t => t.Color).HasColumnName("Color");
            this.Property(t => t.ParentID).HasColumnName("ParentID");
            this.Property(t => t.OtherAmount).HasColumnName("OtherAmount");
            this.Property(t => t.Level).HasColumnName("Level");
        }
    }
}
